  function indexOnload(){
   Nifty("div.dmenu","transparent");
   Nifty("div.dentrada","transparent top");
  }

  function votoMarcar(act,pos){
   var mov=act;
   for(i=2;i<=pos;i++){
    mov.src="img/star.png";
    mov=mov.previousSibling;
   }

   mov=act.nextSibling;
   for(i=0;i<5-pos;i++){
    mov.src="img/starOff.png";
    mov=mov.nextSibling;
   }
  }
  
  function userLogin(){
   var aj=new ajax();
   var user=document.getElementById("est_top_input1").value;
   var pass=document.getElementById("est_top_input2").value;
   aj.open("POST", "FrontController?action=login&user="+user+"&pass="+hex_md5(pass),true);
   aj.onreadystatechange=function(){
    if(aj.readyState==4&&aj.status==200){
     if(aj.responseText!="null"){
      drawUserLogin(aj.responseText);
     }
     else{
      falloAlIniciarOn();
      setTimeout("falloAlIniciarOff()",500);
     }
    }
   }
   aj.send(null);
  }
  
  function falloAlIniciarOn(){
   var i1=document.getElementById("est_top_input1");
   var i2=document.getElementById("est_top_input2");
   var i3=document.getElementById("est_top_input3");
   i1.style.color="red";
   i2.style.color="red";
   i3.style.color="red";
   i3.blur();
  }
  
  function falloAlIniciarOff(){
   var i1=document.getElementById("est_top_input1");
   var i2=document.getElementById("est_top_input2");
   var i3=document.getElementById("est_top_input3");
   i1.style.color="gray";
   i2.style.color="gray";
   i3.style.color="gray";
  }
  
  function drawUserLogin(userName){
   var user=document.getElementById("est_top_input1");
   user.disabled=true;
   user.style.border="0px";
   user.value="Hola "+userName;
   var pass=document.getElementById("est_top_input2");
   pass.style.visibility="hidden";
   var button=document.getElementById("est_top_input3");
   button.blur();
   button.onclick=function(){userLogout();};
   button.value="Salir!";
   var mP=document.getElementById("menuPersonal");
   mP.innerHTML="<a href=\"FrontController?action=redirect&url=datosPersonales.jsp\" target=\"ifr_contenido\">Mis datos personales</a><br />";
   mP.innerHTML+="<a href=\"FrontController?action=redirect&url=misJuegosJugados.jsp\" target=\"ifr_contenido\">Mis juegos jugados</a><br />";
   mP.innerHTML+="<a href=\"FrontController?action=redirect&url=misJuegosApadrinados.jsp\" target=\"ifr_contenido\">Mis juegos apadrinados</a><br />";
   mP.innerHTML+="<a href=\"FrontController?action=redirect&url=cambiarPass.jsp\" target=\"ifr_contenido\">Cambiar contrase&ntilde;a</a>";
  }

  function userLogout(){
   var aj=new ajax();
   aj.open("POST", "FrontController?action=logout",true);
   aj.onreadystatechange=function(){
    if(aj.readyState==4&&aj.status==200){
     if(aj.responseText=="logout"){
      drawUserLogout();
      document.getElementById("ifr_contenido").src="inicio.jsp";
     }
    }
   }
   aj.send(null);
  }
  
  function drawUserLogout(){
   var user=document.getElementById("est_top_input1");
   user.disabled=false;
   user.style.border="1px solid gray";
   user.value="";
   var pass=document.getElementById("est_top_input2");
   pass.style.visibility="visible";
   pass.value="";
   var button=document.getElementById("est_top_input3");
   button.blur();
   button.onclick=function(){userLogin();};
   button.value="Acceder";
   var mP=document.getElementById("menuPersonal");
   mP.innerHTML="<a href=\"FrontController?action=redirect&url=creacionUsuario.jsp\" target=\"ifr_contenido\">Nuevo usuario</a>";
  }